﻿using System;
using System.ServiceModel;
using jSLCore.Client.Presentation.AuthorizeService;

namespace jSLCore.Client.Presentation.Authorization
{
    public static class Communication
    {
        private static jSLAuthorizationServiceBaseSyncedChannel proxy;

        public static void InitEndPoint(EndpointAddress rem)
        {
            proxy = new jSLAuthorizationServiceBaseSyncedChannel(new BasicHttpBinding(BasicHttpSecurityMode.None) { MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647 }, rem);
        }

        public static jSLAuthorizationServiceBaseSyncedChannel Proxy
        {
            get
            {
                if(proxy==null)throw new InvalidOperationException("You have to call InitEndPoint before calling jSLAuthorizationService");
                return proxy;
            }
        }

    }
    
}